<?php
$this->pageTitle = '美味推荐';
?>
<style>
    .bartop { height: 9px; background: url(../images/foot.png) repeat-x top center; position: relative; overflow: hidden; }
    .top-nav { width: 1000px; position: absolute; left: 50%; margin-left: -500px; z-index:99; }
    .top-nav ul li { float: left; margin-right: 32px; padding-top: 20px; }
    .top-nav ul li a { color: #FFFFFF; text-decoration: none; padding:0 5px 5px 5px; }
    .top-nav ul li  a:hover,.top-nav ul li.current a {border-bottom: 4px #FFFFFF solid; }

    .top-nav .mtime-logo { position: absolute; top: -9px; left:50%; margin-left: -105px; width: 210px; height: 52px; box-shadow: 0px 3px 3px rgba(0,0,0,0.3);border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; padding-top: 8px; background: #E5E5E5; }
    .top-nav .mtime-logo a { display: block; width: 136px; height: 43px; background: url(./images/banner2/foot.png) no-repeat 0 -10px; margin:0 auto; }

    .top-nav .curcity,.login {position: absolute; top: 15px; height: 29px; line-height: 29px; color: #FFFFFF; font-size: 14px; text-indent: 10px;border: 1px #CDE4EC solid; border-radius :3px; }
    .top-nav .curcity { right: 100px; width: 104px; background: url(./images/banner2/topbar_02.png) no-repeat 88px 3px; }
    .top-nav .login { right: 0px; }
    .top-nav .login-text,.login-icon { display: block;  float: left; }
    .top-nav .login-text { padding-right: 10px; }
    .top-nav .login-icon {width: 27px; height: 29px; border-left: 1px #CFCFD0 solid; background: url(./images/banner2/topbar_03.png) no-repeat center center;}

    .mtime-box { min-width: 1200px; height: 250px; position: relative; overflow: hidden; }
    .mtime-box .bd{ width:100% !important; }
    .mtime-box .bd li .m-width {width: 1222px;padding-top: 0px; margin:0 auto; overflow: hidden; }
    .mtime-box .bd li { width:100% !important; height: 250px; }
    .mtime-box .bd li a { display: block;height:239px; width:1200px;background: url(./images/banner2/index_shadow.png) no-repeat 0 0; background-size: auto; padding: 11px 11px 0 11px; }

    .mtime-btn { width: 1222px; position: absolute; top: 200px; left: 50%; margin-left: -611px; }
    .mtime-btn a { display: block; width: 49px; height: 104px; position: absolute; top: 0; filter: alpha(opacity=40); -moz-opacity: 0.4; -khtml-opacity: 0.4; opacity: 0.4; }
    .mtime-btn a.prev { left: -30px; background: url(./images/banner2/foot.png) no-repeat -1822px -9px; } 
    .mtime-btn a.next { right: -30px; background: url(./images/banner2/foot.png) no-repeat right -9px; }

    .mtime-box .hd {position: absolute; top: 240px; right: 10px; }
    .mtime-box .hd ul li { width: 12px; height: 12px; border-radius :50%; text-indent: -9999px; margin-right: 20px; background: #A0A1A4; border: 1px #A0A1A4 solid; float: left; cursor: pointer; }
    .mtime-box .hd ul li.on { background:  #FFFFFF; }

    .indexcontent { width: 1222px; background: url(./images/banner2/index_shadow.png) no-repeat 0 -310px; margin:0 auto; }
    .indexcontent .i_content { width: 1180px;background: #FFFFFF; position: relative; margin: -35px auto 0 auto; padding:10px;}
    .n_head_menu{
        margin-bottom: 60px;
    }
</style>
<script>
        $(function(){
            $('#slides').slides({
                preload: true,
                preloadImage: '<?php echo Yii::app()->request->baseUrl; ?>/images/v3/loading.gif',
                play: 4000,
                pause: 1000,
                hoverPause: true,
                animationStart: function(){
                    $('.caption').animate({
                        bottom:-35
                    },100);
                },
                animationComplete: function(current){
                    $('.caption').animate({
                        bottom:0
                    },200);
                    if (window.console && console.log) {
                        // example return of current slide number
                        //console.log(current);
                    };
                }
            });
        });
    </script>
    <div id="container">
            <div id="example">
                <div id="slides">
                    <div class="slides_container">

                        <?php foreach ($banner as $key => $value) { ?>
                          <div>
                            <img src="<?php echo $value['url'];?>" width="1280" height="400" alt="Slide 1">                      
                        </div>
                        <?php
                        }
                        ?>
                    </div>
                    <a href="#" class="prev"><img src="<?php echo Yii::app()->request->baseUrl; ?>/images/v3/27.png" width="85" height="84" alt="Arrow Prev"></a>
                    <a href="#" class="next"><img src="<?php echo Yii::app()->request->baseUrl; ?>/images/v3/28.png" width="85" height="84" alt="Arrow Next"></a>
                </div>
            </div>
        </div>

        <div class="food_jing">
            <h2 class="middel_title">
                <span class="m_t_jing">每日精选</span>
            </h2>
            <ul class="food_three clear">
                <?php foreach ($model as $key => $value) { ?>
                    <?php if ($value['status'] == 1 && $key <= 2) { ?>
                        <a href="<?php echo Yii::app()->createUrl('site/product', array('id' => $value['productSkuId'])); ?>">  
                            <li class="<?php if(($key+1)%3 == 0){ echo 'f_t_mr'; }?>" id="p<?php echo $value['id']; ?>">
                                <img src="<?php echo $value['productImg']['0']; ?>" alt="" />
                                <div class="f_t_bac"></div>
                                <div class="f_t_conts">
                                    <p class="f_t_c_name"><?php echo $value['name']; ?></p>
                                    <p class="f_t_c_money">￥<?php echo number_format($value['skuPrice'], 2); ?></p>
                                    <p class="f_t_c_put"></p>
                                </div>
                            </li>
                        </a> 
                        <?php
                    }
                }
                ?>
                
                
            </ul>
            <div class="f_j_bottom clear">
                <h2 class="f_j_b_title">美食点评</h2>
                <p class="f_j_b_conts">今日主推搭配，营养均衡，在周一适合补充能量提供一整日的工作动力，富含多种维生素符合白领工作需要今日主推搭配营养均衡，在周一适合补充能量提供一整日的工作动力富含多种维生素符合白领工作需要今日主推搭配，营养均衡，在周一适合补充能量提供一整日的工作动力，富含多种维生素符合白领工作需要。</p>
            </div>
        </div>
        <div class="food_tejia">
            <h2 class="middel_title">
                <span class="m_t_jing">天天特价</span>
            </h2>
            <div class="f_t_box clear">
                <div class="f_t_b_conts">
                    <h3 class="f_t_b_title">特价推荐</h3>
                    <p>&nbsp;&nbsp;&nbsp;&nbsp;今日主推搭配，营养均衡，在周一适合补充能量提供一整日的工作动力，富含多种维生素符合白领工作需要今日主推搭配</br></br>&nbsp;&nbsp;&nbsp;&nbsp;营养均衡，在周一适合补充能量提供一整日的工作动力富含多种维生素符合白领工作需要今日主推搭配，营养均衡，在周一适合补充能量提供一整日的工作动力，富含多种维生素符合白领</p>
                </div>
                <div class="f_t_b_middle">
                    <?php foreach ($row_ol as $key => $value) { ?>
                        <?php if ($value['status'] == 1 && $key == 0) { ?>
                            <a href="<?php echo Yii::app()->createUrl('site/product', array('id' => $value['productSkuId'])); ?>">    
                                <img src="<?php echo $value['productImg']['0']; ?>" alt="" />
                                <div class="f_t_bac"></div>
                                <div class="f_t_conts">
                                    <p class="f_t_c_name"><?php echo $value['name']; ?></p>
                                    <p class="f_t_c_money f_t_c_nowmoney">￥<?php echo number_format($value['skuPrice'], 2); ?> <span class="f_t_c_oldmoney">￥<?php echo number_format($value['oriPrice'], 2); ?></span></p>
                                    <p class="f_t_c_put"></p>
                                </div> 
                            </a> 
                            <?php
                        }
                    }
                    ?>
                                    
                </div>
                <ul class="f_t_b_right clear">
                    <?php foreach ($row_ol as $key => $value) { ?>
                        <?php if ($value['status'] == 1 && $key <= 4 && $key >= 1) { ?>
                            <li <?php if ($key <= 2): ?> class="mb6"<?php endif; ?> id="p<?php echo $value['id']; ?>">
                                <a href="<?php echo Yii::app()->createUrl('site/product', array('id' => $value['productSkuId'])); ?>">
                                <img src="<?php echo $value['productImg']['0']; ?>" alt="" />
                                <div class="f_t_bac"></div>
                                <div class="f_t_conts">
                                    <p class="f_t_c_name"><?php echo $value['name']; ?></p>
                                    <p class="f_t_c_money f_t_c_nowmoney">￥<?php echo number_format($value['skuPrice'], 2); ?> <span class="f_t_c_oldmoney">￥<?php echo number_format($value['oriPrice'], 2); ?></span></p>
                                    <p class="f_t_c_put"></p>
                                </div>
                                </a>
                            </li>
                            <?php
                        }
                    }
                    ?>
                    
                    
                </ul>
            </div>
        </div>
        <div class="img_one">
            <img src="<?php echo Yii::app()->request->baseUrl; ?>/images/v3/8.png" alt="" />
        </div>
        <div class="food_meishi">
            <h2 class="middel_title">
                <span class="m_t_time">灵动美食风向标</span>
            </h2>
            <ul class="f_m_menu">
                <li>销量</li>
                <li class="f_m_m_active">评价</li>
                <li class="f_m_m_last">价格</li>
            </ul>
            <div class="f_m_foods">
                <ul class="f_m_fy f_m_fy_top">
                    <li class="f_m_fy_active f_m_fy_1">1</li>
                    <li class="f_m_fy_2">2</li>
                    <li class="f_m_fy_3">3</li>
                </ul>
                <ul class="food_three food_three_more dn clear" sort='saleCount'>
                    <?php foreach ($row_sales as $key => $value) { ?>
                        <?php if ($value['status'] == 1) { ?>
                            <li <?php if (($key+1)%3 == 0): ?> class="f_t_mr"<?php endif; ?> id="p<?php echo $value['id']; ?>">
                                <a href="<?php echo Yii::app()->createUrl('site/product', array('id' => $value['productSkuId'])); ?>">
                                    <img src="<?php echo $value['productImg']['0']; ?>" alt="" />
                                    <div class="f_t_bac"></div>
                                    <div class="f_t_conts">
                                        <p class="f_t_c_name"><?php echo $value['name']; ?></p>
                                        <p class="f_t_c_money">￥<?php echo number_format($value['skuPrice'], 2); ?></p>
                                        <p class="f_t_c_put"></p>
                                    </div>
                                </a>
                                <div class="f_t_buynum">
                                    <span><?php echo $value['saleCount']; ?>购买</span>
                                    <p class="f_t_b_pj"><?php echo $value['commontCount']; ?>评价</p>
                                    <div class="f_t_b_xing"><p style="width:85%;"></p></div>
                                </div>
                                <div class="f_t_comms">
                                    <img src="<?php echo empty($value['comment']['buyerImg'])?Yii::app()->request->baseUrl.'/images/icon50.jpg':$value['comment']['buyerImg'];?>" alt="" />
                                    <p class="f_t_c_title">最新评论</p>
                                    <p class="f_t_c_conts"><?php echo strip_tags($value['comment']['content']); ?></p>
                                </div>
                            </li>
                            <?php
                        }
                    }
                    ?>
                </ul>
                <ul class="food_three food_three_more clear" sort='commontCount'>
                    <?php foreach ($row_commont as $key => $value) { ?>
                        <?php if ($value['status'] == 1) { ?>
                            <li <?php if (($key+1)%3 == 0): ?> class="f_t_mr"<?php endif; ?> id="p<?php echo $value['id']; ?>">
                                <a href="<?php echo Yii::app()->createUrl('site/product', array('id' => $value['productSkuId'])); ?>">
                                    <img src="<?php echo $value['productImg']['0']; ?>" alt="" />
                                    <div class="f_t_bac"></div>
                                    <div class="f_t_conts">
                                        <p class="f_t_c_name"><?php echo $value['name']; ?></p>
                                        <p class="f_t_c_money">￥<?php echo number_format($value['skuPrice'], 2); ?></p>
                                        <p class="f_t_c_put"></p>
                                    </div>
                                </a>
                                <div class="f_t_buynum">
                                    <span><?php echo $value['saleCount']; ?>购买</span>
                                    <p class="f_t_b_pj"><?php echo $value['commontCount']; ?>评价</p>
                                    <div class="f_t_b_xing"><p style="width:85%;"></p></div>
                                </div>
                                <div class="f_t_comms">
                                    <img src="<?php echo empty($value['comment']['buyerImg'])?Yii::app()->request->baseUrl.'/images/icon50.jpg':$value['comment']['buyerImg'];?>" alt="" />
                                    <p class="f_t_c_title">最新评论</p>
                                    <p class="f_t_c_conts"><?php echo strip_tags($value['comment']['content']); ?></p>
                                </div>
                            </li>
                            <?php
                        }
                    }
                    ?>
                </ul>
                <ul class="food_three food_three_more dn clear" sort='skuPrice'>
                    <?php foreach ($row_collection as $key => $value) { ?>
                        <?php if ($value['status'] == 1) { ?>
                            <li <?php if (($key+1)%3 == 0): ?> class="f_t_mr"<?php endif; ?> id="p<?php echo $value['id']; ?>">
                                <a href="<?php echo Yii::app()->createUrl('site/product', array('id' => $value['productSkuId'])); ?>">
                                    <img src="<?php echo $value['productImg']['0']; ?>" alt="" />
                                    <div class="f_t_bac"></div>
                                    <div class="f_t_conts">
                                        <p class="f_t_c_name"><?php echo $value['name']; ?></p>
                                        <p class="f_t_c_money">￥<?php echo number_format($value['skuPrice'], 2); ?></p>
                                        <p class="f_t_c_put"></p>
                                    </div>
                                </a>
                                <div class="f_t_buynum">
                                    <span><?php echo $value['saleCount']; ?>购买</span>
                                    <p class="f_t_b_pj"><?php echo $value['commontCount']; ?>评价</p>
                                    <div class="f_t_b_xing"><p style="width:85%;"></p></div>
                                </div>
                                <div class="f_t_comms">
                                    <img src="<?php echo Yii::app()->request->baseUrl; ?>/images/v3/12.png" alt="" />
                                    <p class="f_t_c_title">最新评论</p>
                                    <p class="f_t_c_conts"><?php echo strip_tags($value['comment']['content']); ?></p>
                                </div>
                            </li>
                            <?php
                        }
                    }
                    ?>
                </ul>
                <ul class="f_m_fy f_m_fy_bottom">
                    <li class="f_m_fy_active f_m_fy_1">1</li>
                    <li class="f_m_fy_2">2</li>
                    <li class="f_m_fy_3">3</li>
                </ul>
            </div>
        </div>
        <script>
            $('.f_m_fy li').click(function(){ 

                var new_data="";
                var page = $(this).text();
                var sort = $(".food_three_more:visible").attr('sort');
                var append_obj = $(".food_three_more:visible");
                $.ajax({
                          type: 'GET',
                          url: '/site/ajaxproduct',
                          data: {num:9,page:page,sort:sort},
                          dataType: 'json',
                          success: function(data){
                              $.each(data,function(i,item){
                                    
                                    if(i%3==2){
                                        new_data+='<li class="f_t_mr" id="p'+item.id+'">';
                                    }
                                    else{
                                        new_data+='<li>';
                                    }          
                                        new_data += '<a href="'+item.url+'">'             
                                        new_data+='<img src="'+item.productImg+'" alt="" />';
                                        new_data+='<div class="f_t_bac"></div>';
                                        new_data+='<div class="f_t_conts">';
                                            new_data+='<p class="f_t_c_name">'+item.name+'</p>';
                                            new_data+='<p class="f_t_c_money">￥'+item.skuPrice+'</p>';
                                            new_data+='<p class="f_t_c_put"></p>';
                                        new_data+='</div>';
                                        new_data+='<div class="f_t_buynum">';
                                            new_data+='<span>'+item.saleCount+'购买</span>';
                                            new_data+='<p class="f_t_b_pj">'+item.commontCount+'评价</p>';
                                            new_data+='<div class="f_t_b_xing"><p style="width:85%;"></p></div>';
                                        new_data+='</div>';
                                        new_data+='<div class="f_t_comms">';
                                            new_data+='<img src="'+item.comment.buyerImg+'" alt="" />';
                                            new_data+='<p class="f_t_c_title">最新评论</p>';
                                            new_data+='<p class="f_t_c_conts">'+item.comment.content+'</p>';
                                        new_data+='</div>';
                                    new_data+='</li>';
                              });
                                var append = $(new_data).hide(); 
                              append_obj.html(new_data);
                              append.fadeIn();
                          },
                          error: function(xhr, type){
                            console.log('获取失败');
                          }
                    });
              $('.f_m_fy li').removeClass("f_m_fy_active");
              
              $('.f_m_fy .f_m_fy_'+page).addClass("f_m_fy_active");

            })
        
        </script>
<script type="text/javascript">
//    $(".prev,.next").hover(function() {
//        $(this).stop(true, false).fadeTo("show", 0.9);
//    }, function() {
//        $(this).stop(true, false).fadeTo("show", 0.4);
//    })
//    $(".mtime-box").slide({
//        titCell: ".hd ul",
//        mainCell: ".bd ul",
//        effect: "fold",
//        interTime: 3500,
//        delayTime: 500,
//        autoPlay: true,
//        autoPage: true,
//        trigger: "click"
//    });
</script>